//
//  PhotoView.m
//  HuiWenMovie
//
//  Created by ios on 15/7/23.
//  Copyright (c) 2015年 ios. All rights reserved.
//

#import "PhotoView.h"
#import "PhotoCollectionViewCell.h"
@implementation PhotoView

- (id)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout
{
    self = [super initWithFrame:frame collectionViewLayout:layout];
    if (self)
    {
        [self registerClass:[PhotoCollectionViewCell class] forCellWithReuseIdentifier:@"photoCell"];
        self.delegate = self;
        self.dataSource = self;
    }
    
    
    return  self;
}

- (void)setImageStringOfUrl:(NSArray *)imageStringOfUrl
{
    _imageStringOfUrl = imageStringOfUrl;

}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return [self.imageStringOfUrl count];
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    PhotoCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"photoCell" forIndexPath:indexPath];
    cell.imageUrlString = self.imageStringOfUrl[indexPath.row];
    
    return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath
{
    PhotoCollectionViewCell *photoCell = (PhotoCollectionViewCell*)cell;
    
    ScrollView *scrollView = (ScrollView *)[photoCell viewWithTag:100];
    
    [scrollView setZoomScale:1.0 animated:YES];

}

@end
